package practice;

public class Producer implements Runnable {

	ISink sink;
	IResourceFactory resourceFactory;

	public Producer(ISink sink, IResourceFactory resourceFactory) {
		this.sink = sink;
		this.resourceFactory = resourceFactory;
	}

	@Override
	public void run() {

		Resource resource = resourceFactory.get();

		System.out.println(Thread.currentThread().toString() + ": produced "
				+ resource);
		sink.push(resource);
	}
}
